//
//  StoreSandBox.h
//  课堂代码重构
//
//  Created by dllo on 16/5/26.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import <Foundation/Foundation.h>
@import UIKit;


@interface StoreSandBox : NSObject


#pragma mark - 单例
+ (instancetype)shareStoreSandBox;


#pragma mark - 将缓存写入
- (void)storeByArchiver:(id)object key:(NSString *)key;

- (NSMutableArray *)readByArchiver:(NSString *)key;
#pragma mark - getAddress
/** 沙盒地址*/
- (NSString *) pathOfSandBox;

/** Documents 文件夹地址 */
- (NSString *) pathOfDocuments;

/** Library 文件夹地址 */
- (NSString *) pathOfLibrary;

/** Caches 文件夹地址*/
- (NSString *) pathOfCaches;

/** tmp 文件夹地址*/
- (NSString *) pathOfTmp;

/** APP地址 捆绑包地址*/
- (NSString *) pathForApp;

#pragma mark - storeFile
/** 存字符串*/
- (BOOL) storeWithString:(NSString *)content
                  forKey:(NSString *)key;

/** 存数组*/
- (BOOL) storeWithArray:(NSArray *)arrar
                 forKey:(NSString *)key;

/** 存字典*/
- (BOOL) storeWithDictionary:(NSDictionary *)dictionary
                      forKey:(NSString *)key;

/** 存可变字典*/
- (BOOL) storeWithMutableDictionary:(NSMutableDictionary *)dictionary
                             forKey:(NSString *)key;


/** 存图像*/
- (BOOL) storeWithImageName:(NSString *)name
                     forKey:(NSString *)key;

/** 存Data文件*/
- (BOOL) storeFileWithData:(NSData *)data
                    forKey:(NSString *)key;

/** 非foundation内的框架类 写入*/
- (BOOL) StoreByArchiverWithObject:(id)object
                            forKey:(NSString *)key;

#pragma mark - readFile

/** 取字符串*/
- (NSString *) readWithStringForKey:(NSString *)key;
/** 取数组*/
- (NSArray *) readWithArrayForKey:(NSString *)key;

/** 取字典*/
- (NSDictionary *) readWithDictionaryForKey:(NSString *)key;

/** 取可变字典*/
- (NSMutableDictionary *) readWithMutableDictionaryForKey:(NSString *)key;

/** 取图像*/
- (UIImage *) readWithImageForKey:(NSString *)key;

/** 非foundation内的框架类 读取*/
- (id) readByUnArchiverWithObjectForKey:(NSString *)key;
#pragma mark - 在缓存区 管理文件夹


/** 创建文件管理器*/
- (NSFileManager *) createManager;

/** 创建某区文件夹*/
- (BOOL) createDirectoryAtPath:(NSString *)path
                       forName:(NSString *)name;
/** 删除某区文件夹*/
- (BOOL) removeDirectoryAtCachesOfFileName:(NSString *)name;


/** 计算目录大小. */

- (float)folderSizeAtPath:(NSString *)path;


/** 清理缓存. */

//- (void)clearCCaches:(NSString *)NSIndexPath;
@end
